package com.asiainfo.wx.portal;

import java.util.Arrays;

import com.alibaba.fastjson.JSONObject;

import com.zteits.clouds.api.apibase.bean.BizResult;
import com.zteits.clouds.api.dto.clouds.dto.PLRealTimeStatusBeanDTO;
import com.zteits.clouds.api.dto.clouds.param.RealTimeMonitorByPlNosRequest;
import com.zteits.clouds.api.service.park.parkrealtime.ParkRealTimeQueryService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Copyright: Copyright (c) 2019  zteits
 *
 * @ClassName: com.asiainfo.wx.portal
 * @Description:
 * @version: v1.0.0
 * @author: atao
 * @date: 2019-10-28   17:04
 * Modification History:
 * Date         Author          Version      Description
 * ---------------------------------------------------------*
 * 2019-10-28      atao          v1.0.0          创建
 */
@Controller
@RequestMapping("/test")
@Slf4j
public class TestController {

    @Autowired()
    private ParkRealTimeQueryService parkRealTimeQueryService;

    @GetMapping("/dubboTest")
    @ResponseBody
    public BizResult<PLRealTimeStatusBeanDTO> dubboTest() {

        RealTimeMonitorByPlNosRequest request = new RealTimeMonitorByPlNosRequest();
        request.setSysCode("123");
        request.setPlNos(Arrays.asList("A150402000","A150402001"));

        log.info("请求入参为:" + JSONObject.toJSONString(request));
        BizResult<PLRealTimeStatusBeanDTO> result = parkRealTimeQueryService.queryParkRealTimeDatasByPlNos(request);
        log.info("响应结果为:" + JSONObject.toJSONString(result));

        return result;

    }

    @GetMapping("/htmlTest")
    public String htmlTest(@RequestParam("code")String code){
        log.info("code={}",code);
        return "index";
    }
}
